import java.util.Scanner;

public class test12 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int sum = 0;
        for (int j = 0; j < n; j++) {
            int ret = 1;
            for (int i = 1; i < j;i ++) {
                ret *=i;
            }
            sum+=ret;
        }
        System.out.println(sum);
//        int a = 0;
//        do{
//            System.out.println(a);
//        }while(a!=0);//至少执行一次
    }
}
